package com.xyy.dynamic;

import java.lang.reflect.Proxy;

/**
 * @author xyy
 * @date 2019/4/12
 */
public class Client {
    public static void main(String[] args) {
        Subject subject = new RealSubject();
        Handler handler = new Handler(subject);
        Subject proxy = (Subject) Proxy.newProxyInstance(handler.getClass().getClassLoader(), subject.getClass().getInterfaces(), handler);
        proxy.send("msg");
        proxy.receive("msg");
    }
}
